//
//  HorizontalController.m
//  Layout
//
//  Created by  on 11-11-23.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "HorizontalController.h"
#import "LayoutBlockView.h"
#import "ZBHorizontalLayout.h"

@implementation HorizontalController

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"Horizontal Layout";
    
    ZBHorizontalLayout *layout = [[[ZBHorizontalLayout alloc] initWithFrame:self.view.bounds] autorelease];
    layout.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    layout.verticalAlignment = ZBLayoutAlignmentBottom;
    layout.spacing = 5.0;
    [self.view addSubview:layout];
    
    // Do any additional setup after loading the view from its nib.
    LayoutBlockView *blockView =  [[LayoutBlockView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    blockView.title = @"block1";
    [layout addSubview:blockView];
    
    blockView =  [[LayoutBlockView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    blockView.title = @"block2";
    [layout addSubview:blockView];
    
    blockView =  [[LayoutBlockView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    blockView.title = @"block3";
    [layout addSubview:blockView];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
